package de.cbf.cam.dsa.entity.edit.talent.act;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.ui.IPartListener2;

import de.cbf.cam.dsa.entity.edit.talent.controller.EditTalentsMainController;
import de.cbf.cam.dsa.entity.edit.talent.resolver.service_resolver.IServiceResolver_EntityTalent;
import de.cbf.util.entity.edit.controller.AbstractActivatorEntityEdit;
import de.cbf.util.entity.facet.persistence.resolver.IServiceResolverEntity;

/**
 * The activator class controls the plug-in life cycle
 */
public class ActivatorEditEntityTalent extends AbstractActivatorEntityEdit {
	private static final Log logger = LogFactory.getLog(ActivatorEditEntityTalent.class);
	
	// The plug-in ID
	public static final String PLUGIN_ID = "de.cbf.cam.dsa.entity.edit.talent"; //$NON-NLS-1$
	
	public static final String LOG_VIEW_TALENT_EDIT_SEC_ID = "EditTalentLogViewSecondaryId";
	
	// The shared instance
	private static ActivatorEditEntityTalent plugin;
	

	public ActivatorEditEntityTalent() {
		super();		
	}

	/**
	 * Returns the shared instance
	 *
	 * @return the shared instance
	 */
	public static ActivatorEditEntityTalent getDefault() {
		return plugin;
	}

	@Override
	protected IPartListener2 getMainControllerInstance() {		
		return EditTalentsMainController.getInstance();
	}

	@Override
	protected Class<? extends IServiceResolverEntity> getServiceEntityResolverClass() {
		return IServiceResolver_EntityTalent.class;
	}

	@Override
	protected void setPluginInstance(AbstractActivatorEntityEdit activatorFacet) {
		if (activatorFacet instanceof ActivatorEditEntityTalent) {
			ActivatorEditEntityTalent activator = (ActivatorEditEntityTalent) activatorFacet;
			plugin= activator;
		} else {
			String err_msg = "entity of wrong type(expected "+ ActivatorEditEntityTalent.class.getSimpleName() + "): " + (activatorFacet == null ? "null"
					: activatorFacet.getClass().getSimpleName());
			logger.error(err_msg);
		}		
	}	
	
	@Override
	protected String getPlugin_ID() {		
		return PLUGIN_ID;
	}
}
